@page
@{
    ViewData["Title"] = "模拟登录";
}
<div id="root" class="app-wrapper"></div>

@section Scripts {
    <script>
                (function () {
            let amis = amisRequire('amis/embed');
            const match = amisRequire('path-to-regexp').match;

            // 通过替换下面这个配置来生成不同页面
            let amisJSON =
            {
                "type": "page",
                "title": "",
                "body": {
                        "type": "spinner",
                         "tip": "模拟登录跳转中...",
                         "delay":1000,
                        "show": true,
                        "size": "lg"
                }
            };
            let amisScoped = amis.embed('#root', amisJSON, {
                location: history.location,
                data: {},
                context: {
                    API_HOST: 'https://localhost:17134'
                }
            }, { theme: 'antd' });
        })();

        // 从URL获取token参数
        const urlParams = new URLSearchParams(window.location.search);
        const token = urlParams.get('token');

        if (token) {
            TokenManager.setToken(token);
            // 跳转到根页面
            window.location.href = '/';
        } else {
            alert('Token参数不能为空');
            window.location.href = '/';
        }
    </script>
}
